<?php

	class MediaItemModel extends ObjectModel
	{

		public function __construct()
		{
			parent::init('md_item','Media/MediaItemVO','mi_id');
		}
		
		public function deleteByMediaId($id)
		{
			
		}
		
		public function getColumns()
		{
			return array(
				new EbTableColumn('mi_id','int',true,0x01,true),
				new EbTableColumn('md_id','int'),
				new EbTableColumn('ob_id','int'),
				new EbTableColumn('pr_id','int'),
				new EbTableColumn('ex_id','int'),
				new EbTableColumn('code','text'),
				new EbTableColumn('type','smallint'),
				new EbTableColumn('size','int',false,0,false,0)
			);
		}
		
		public function selectByMedia($md_id,$whereClause = null)
		{
			return $this->selectBymd_id($md_id,$whereClause);
		}
		
		public function selectByMediasAndPrepare($sql)
		{
			$buffer = $this->executeSelectQuery($sql);
			
			foreach ($buffer AS $item)
			{
				$item->url = Media_HttpProvider::getFileUrl($item);
			}
			
			return $buffer;
		}
	}